<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>社交网络 - 动态列表</title>
    <!-- 引入Bootstrap 5 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 引入Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <style>
        :root {
            --primary: #1877F2;
            --primary-light: #E8F3FF;
            --secondary: #65676B;
            --light-bg: #F0F2F5;
            --card-bg: #FFFFFF;
            --border-color: #DADDE1;
            --text-dark: #1C1E21;
            --text-light: #65676B;
            --success: #42B72A;
            --radius: 8px;
            --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        }
        
        body {
            font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background-color: var(--light-bg);
            color: var(--text-dark);
            line-height: 1.5;
        }
        
        .container {
            max-width: 720px;
        }
        
        /* 顶部导航 */
        .navbar {
            background-color: white;
            border-bottom: 1px solid var(--border-color);
            padding: 0.75rem 1rem;
        }
        
        .navbar-brand {
            font-weight: 600;
            color: var(--primary);
            font-size: 1.5rem;
        }
        
        /* 发布框 */
        .post-box {
            background-color: var(--card-bg);
            border-radius: var(--radius);
            padding: 1rem;
            margin: 1.5rem 0;
            box-shadow: var(--shadow);
        }
        
        .post-input-container {
            display: flex;
            gap: 0.75rem;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .post-input {
            flex-grow: 1;
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 0.75rem 1rem;
            font-size: 0.95rem;
            transition: all 0.2s;
        }
        
        .post-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px var(--primary-light);
        }
        
        .post-actions {
            display: flex;
            justify-content: space-around;
            margin-top: 1rem;
        }
        
        .post-action {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-light);
            padding: 0.5rem 0.75rem;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .post-action:hover {
            background-color: var(--light-bg);
            color: var(--primary);
        }
        
        /* 动态列表 */
        .feed-container {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        
        .post-card {
            background-color: var(--card-bg);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        
        .post-header {
            padding: 1rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        
        .post-user-info {
            flex-grow: 1;
        }
        
        .post-username {
            font-weight: 600;
            margin-bottom: 0;
        }
        
        .post-time {
            font-size: 0.8rem;
            color: var(--secondary);
        }
        
        .post-menu {
            color: var(--secondary);
            cursor: pointer;
        }
        
        .post-content {
            padding: 0 1rem;
            margin-bottom: 1rem;
        }
        
        .post-text {
            margin-bottom: 1rem;
            line-height: 1.6;
        }
        
        .post-media {
            border-radius: var(--radius);
            overflow: hidden;
            margin-bottom: 0.5rem;
        }
        
        .post-image {
            width: 100%;
            display: block;
        }
        
        .post-gallery {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2px;
        }
        
        .post-gallery-3 {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
        }
        
        .post-gallery-3 img:first-child {
            grid-column: 1 / 2;
            grid-row: 1 / 3;
        }
        
        .post-gallery-4 {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
        }
        
        /* 转发内容样式 */
        .repost-container {
            background-color: var(--light-bg);
            border-radius: var(--radius);
            padding: 0.75rem;
            margin-bottom: 1rem;
            font-size: 0.95rem;
        }
        
        .repost-header {
            color: var(--secondary);
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
        }
        
        .repost-header i {
            margin-right: 0.25rem;
        }
        
        .repost-author {
            font-weight: 600;
            margin-right: 0.5rem;
        }
        
        .repost-content {
            line-height: 1.5;
        }
        
        .repost-media {
            margin-top: 0.5rem;
            border-radius: 6px;
            overflow: hidden;
        }
        
        /* 动态底部交互区 */
        .post-footer {
            padding: 0.75rem 1rem;
            border-top: 1px solid var(--border-color);
        }
        
        .post-stats {
            display: flex;
            justify-content: space-between;
            padding-bottom: 0.75rem;
            border-bottom: 1px solid var(--border-color);
            font-size: 0.85rem;
            color: var(--secondary);
        }
        
        .post-actions {
            display: flex;
            justify-content: space-around;
            padding-top: 0.75rem;
        }
        
        .post-action-btn {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-light);
            background: none;
            border: none;
            padding: 0.5rem 0.75rem;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9rem;
        }
        
        .post-action-btn:hover {
            background-color: var(--light-bg);
            color: var(--primary);
        }
        
        .post-action-btn.liked {
            color: #F72585;
        }
        
        .post-action-btn.reposted {
            color: var(--success);
        }
        
        /* 评论区 */
        .comments-section {
            padding: 0 1rem 1rem;
            border-top: 1px solid var(--border-color);
        }
        
        .comment {
            display: flex;
            gap: 0.75rem;
            margin-bottom: 1rem;
            padding-top: 1rem;
        }
        
        .comment-content {
            flex-grow: 1;
            background-color: var(--light-bg);
            border-radius: 18px;
            padding: 0.75rem 1rem;
        }
        
        .comment-author {
            font-weight: 600;
            font-size: 0.9rem;
            margin-right: 0.5rem;
        }
        
        .comment-text {
            display: inline;
            font-size: 0.9rem;
        }
        
        .comment-actions {
            display: flex;
            gap: 1rem;
            margin-top: 0.5rem;
            font-size: 0.8rem;
            color: var(--secondary);
        }
        
        .comment-action {
            cursor: pointer;
        }
        
        .comment-action:hover {
            color: var(--primary);
        }
        
        /* 评论回复 */
        .comment-replies {
            margin-left: 3rem;
            margin-top: 0.5rem;
        }
        
        .reply {
            display: flex;
            gap: 0.75rem;
            margin-bottom: 0.75rem;
            padding-top: 0.75rem;
        }
        
        /* 添加评论 */
        .add-comment {
            display: flex;
            gap: 0.75rem;
            margin-top: 1rem;
        }
        
        .comment-input {
            flex-grow: 1;
            background-color: var(--light-bg);
            border: none;
            border-radius: 20px;
            padding: 0.75rem 1rem;
            font-size: 0.9rem;
        }
        
        .comment-input:focus {
            outline: none;
        }
        
        /* 响应式设计 */
        @media (max-width: 576px) {
            .post-action span {
                display: none;
            }
            
            .post-action {
                justify-content: center;
            }
            
            .post-action-btn span {
                display: none;
            }
            
            .post-action-btn {
                justify-content: center;
            }
            
            .comment-replies {
                margin-left: 2rem;
            }
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <nav class="navbar sticky-top">
        <div class="container">
            <a class="navbar-brand" href="#">
                <i class="fab fa-facebook-square me-2"></i>社交圈
            </a>
            <div class="d-flex gap-3">
                <button class="btn btn-outline-primary">
                    <i class="fas fa-user-plus me-1"></i> 关注
                </button>
                <button class="btn btn-primary">
                    <i class="fas fa-pen me-1"></i> 发布
                </button>
            </div>
        </div>
    </nav>
    
    <div class="container py-4">
        <!-- 发布框 -->
        <div class="post-box">
            <div class="post-input-container">
                <img src="https://picsum.photos/id/64/100/100" alt="你的头像" class="user-avatar">
                <input type="text" class="post-input" placeholder="分享你的想法...">
            </div>
            <div class="post-actions">
                <div class="post-action">
                    <i class="fas fa-image text-primary"></i>
                    <span>图片</span>
                </div>
                <div class="post-action">
                    <i class="fas fa-video text-success"></i>
                    <span>视频</span>
                </div>
                <div class="post-action">
                    <i class="fas fa-smile text-warning"></i>
                    <span>表情</span>
                </div>
                <div class="post-action">
                    <i class="fas fa-map-marker-alt text-danger"></i>
                    <span>位置</span>
                </div>
            </div>
        </div>
        
        <!-- 动态列表 -->
        <div class="feed-container">
            <!-- 动态1：无图片 -->
            <div class="post-card">
                <div class="post-header">
                    <img src="https://picsum.photos/id/1012/100/100" alt="用户头像" class="user-avatar">
                    <div class="post-user-info">
                        <p class="post-username">王读书</p>
                        <p class="post-time">今天 09:15 · 来自 手机客户端</p>
                    </div>
                    <div class="post-menu">
                        <i class="fas fa-ellipsis-h"></i>
                    </div>
                </div>
                
                <div class="post-content">
                    <div class="post-text">
                        今天读完了《原子习惯》这本书，真的受益匪浅。分享几个核心观点：
                        1. 微小的改变积累起来会带来巨大的成果
                        2. 关注系统而非目标
                        3. 让好习惯变得显而易见、有吸引力、简单易行、令人满足
                        4. 身份的改变先于行为的改变

                        强烈推荐给所有想提升自己的朋友！
                    </div>
                </div>
                
                <div class="post-footer">
                    <div class="post-stats">
                        <span><i class="far fa-heart"></i> 87</span>
                        <span><i class="far fa-comment"></i> 15</span>
                        <span><i class="far fa-share-square"></i> 6</span>
                    </div>
                    <div class="post-actions">
                        <button class="post-action-btn">
                            <i class="far fa-heart"></i>
                            <span>点赞</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-comment"></i>
                            <span>评论</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-share-square"></i>
                            <span>分享</span>
                        </button>
                    </div>
                </div>
                
                <div class="comments-section">
                    <div class="comment">
                        <img src="https://picsum.photos/id/1025/100/100" alt="评论用户头像" class="user-avatar">
                        <div class="comment-content">
                            <span class="comment-author">赵旅行</span>
                            <span class="comment-text">这本书我也读过！"习惯追踪"那个方法真的很有效</span>
                            <div class="comment-actions">
                                <span class="comment-action">回复</span>
                                <span class="comment-action">点赞 (3)</span>
                            </div>
                            
                            <div class="comment-replies">
                                <div class="reply">
                                    <img src="https://picsum.photos/id/1012/100/100" alt="回复用户头像" class="user-avatar">
                                    <div class="comment-content">
                                        <span class="comment-author">王读书</span>
                                        <span class="comment-text">@赵旅行 是的，可视化的进步确实能带来持续的动力</span>
                                        <div class="comment-actions">
                                            <span class="comment-action">回复</span>
                                            <span class="comment-action">点赞 (1)</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="add-comment">
                        <img src="https://picsum.photos/id/64/100/100" alt="你的头像" class="user-avatar">
                        <input type="text" class="comment-input" placeholder="添加评论...">
                    </div>
                </div>
            </div>
            
            <!-- 动态2：多张图片（4张） -->
            <div class="post-card">
                <div class="post-header">
                    <img src="https://picsum.photos/id/1005/100/100" alt="用户头像" class="user-avatar">
                    <div class="post-user-info">
                        <p class="post-username">张小厨</p>
                        <p class="post-time">昨天 18:30 · 来自 桌面端</p>
                    </div>
                    <div class="post-menu">
                        <i class="fas fa-ellipsis-h"></i>
                    </div>
                </div>
                
                <div class="post-content">
                    <div class="post-text">
                        周末家庭聚餐，准备了一桌家常菜，大家吃得很开心！分享一下成果，有喜欢的可以留言要菜谱~
                    </div>
                    <div class="post-media">
                        <div class="post-gallery post-gallery-4">
                            <img src="https://picsum.photos/id/292/400/400" alt="红烧肉" class="post-image">
                            <img src="https://picsum.photos/id/488/400/400" alt="炒时蔬" class="post-image">
                            <img src="https://picsum.photos/id/312/400/400" alt="汤品" class="post-image">
                            <img src="https://picsum.photos/id/493/400/400" alt="甜点" class="post-image">
                        </div>
                    </div>
                </div>
                
                <div class="post-footer">
                    <div class="post-stats">
                        <span><i class="far fa-heart"></i> 245</span>
                        <span><i class="far fa-comment"></i> 56</span>
                        <span><i class="far fa-share-square"></i> 23</span>
                    </div>
                    <div class="post-actions">
                        <button class="post-action-btn liked">
                            <i class="fas fa-heart"></i>
                            <span>已赞</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-comment"></i>
                            <span>评论</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-share-square"></i>
                            <span>分享</span>
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 动态3：转发内容（带评论） -->
            <div class="post-card">
                <div class="post-header">
                    <img src="https://picsum.photos/id/237/100/100" alt="用户头像" class="user-avatar">
                    <div class="post-user-info">
                        <p class="post-username">李明</p>
                        <p class="post-time">昨天 14:20 · 来自 手机客户端</p>
                    </div>
                    <div class="post-menu">
                        <i class="fas fa-ellipsis-h"></i>
                    </div>
                </div>
                
                <div class="post-content">
                    <div class="post-text">
                        完全同意这个观点，坚持运动真的能改变一个人的精神状态！
                    </div>
                    
                    <!-- 转发内容 -->
                    <div class="repost-container">
                        <div class="repost-header">
                            <i class="fas fa-retweet"></i> 转发自 <span class="repost-author">健康生活</span>
                        </div>
                        <div class="repost-content">
                            <span class="repost-author">健康生活</span>
                            <span>研究表明，每周至少进行150分钟中等强度的有氧运动，不仅能改善身体健康，还能显著提升心理健康和工作效率。运动是最好的投资，没有之一。</span>
                            <div class="repost-media">
                                <img src="https://picsum.photos/id/1058/800/400" alt="运动图片" class="post-image">
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="post-footer">
                    <div class="post-stats">
                        <span><i class="far fa-heart"></i> 132</span>
                        <span><i class="far fa-comment"></i> 34</span>
                        <span><i class="far fa-share-square"></i> 18</span>
                    </div>
                    <div class="post-actions">
                        <button class="post-action-btn">
                            <i class="far fa-heart"></i>
                            <span>点赞</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-comment"></i>
                            <span>评论</span>
                        </button>
                        <button class="post-action-btn reposted">
                            <i class="fas fa-retweet"></i>
                            <span>已转发</span>
                        </button>
                    </div>
                </div>
                
                <div class="comments-section">
                    <div class="comment">
                        <img src="https://picsum.photos/id/1027/100/100" alt="评论用户头像" class="user-avatar">
                        <div class="comment-content">
                            <span class="comment-author">王芳</span>
                            <span class="comment-text">我每天早上跑步30分钟，坚持了半年，感觉整个人都不一样了</span>
                            <div class="comment-actions">
                                <span class="comment-action">回复</span>
                                <span class="comment-action">点赞 (8)</span>
                            </div>
                            
                            <div class="comment-replies">
                                <div class="reply">
                                    <img src="https://picsum.photos/id/237/100/100" alt="回复用户头像" class="user-avatar">
                                    <div class="comment-content">
                                        <span class="comment-author">李明</span>
                                        <span class="comment-text">@王芳 太厉害了！我才坚持了一个月，还要向你学习</span>
                                        <div class="comment-actions">
                                            <span class="comment-action">回复</span>
                                            <span class="comment-action">点赞 (2)</span>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="reply">
                                    <img src="https://picsum.photos/id/1066/100/100" alt="回复用户头像" class="user-avatar">
                                    <div class="comment-content">
                                        <span class="comment-author">张伟</span>
                                        <span class="comment-text">@王芳 早上跑步会不会影响白天工作精力？</span>
                                        <div class="comment-actions">
                                            <span class="comment-action">回复</span>
                                            <span class="comment-action">点赞 (1)</span>
                                        </div>
                                        
                                        <div class="comment-replies">
                                            <div class="reply">
                                                <img src="https://picsum.photos/id/1027/100/100" alt="回复用户头像" class="user-avatar">
                                                <div class="comment-content">
                                                    <span class="comment-author">王芳</span>
                                                    <span class="comment-text">@张伟 不会的，反而会更有精神，试一段时间就知道了</span>
                                                    <div class="comment-actions">
                                                        <span class="comment-action">回复</span>
                                                        <span class="comment-action">点赞 (3)</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="comment">
                        <img src="https://picsum.photos/id/1074/100/100" alt="评论用户头像" class="user-avatar">
                        <div class="comment-content">
                            <span class="comment-author">刘医生</span>
                            <span class="comment-text">科学运动确实很重要，但也要注意适度，避免运动损伤</span>
                            <div class="comment-actions">
                                <span class="comment-action">回复</span>
                                <span class="comment-action">点赞 (5)</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="add-comment">
                        <img src="https://picsum.photos/id/64/100/100" alt="你的头像" class="user-avatar">
                        <input type="text" class="comment-input" placeholder="添加评论...">
                    </div>
                </div>
            </div>
            
            <!-- 动态4：转发文章 -->
            <div class="post-card">
                <div class="post-header">
                    <img src="https://picsum.photos/id/1066/100/100" alt="用户头像" class="user-avatar">
                    <div class="post-user-info">
                        <p class="post-username">张伟</p>
                        <p class="post-time">3天前 · 来自 桌面端</p>
                    </div>
                    <div class="post-menu">
                        <i class="fas fa-ellipsis-h"></i>
                    </div>
                </div>
                
                <div class="post-content">
                    <div class="post-text">
                        这篇文章分析得很透彻，推荐给做产品的朋友看看。
                    </div>
                    
                    <!-- 转发的文章 -->
                    <div class="repost-container">
                        <div class="repost-header">
                            <i class="fas fa-link"></i> 分享自 <span class="repost-author">产品思维</span>
                        </div>
                        <div class="repost-content">
                            <div class="d-flex gap-1.5rem">
                                <img src="https://picsum.photos/id/3/200/200" alt="文章封面" class="post-image" style="width: 100px; height: 100px; flex-shrink: 0;">
                                <div>
                                    <h5 style="font-weight: 600; margin-bottom: 0.5rem;">从0到1打造成功产品：产品经理必备的思维模型</h5>
                                    <p style="font-size: 0.9rem; color: var(--text-light); margin-bottom: 0.5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;">
                                        本文介绍了7个核心思维模型，帮助产品经理在竞争激烈的市场中找到产品定位，解决用户痛点，实现产品从0到1的突破...
                                    </p>
                                    <p style="font-size: 0.8rem; color: var(--secondary);">产品思维 · 5分钟阅读</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="post-footer">
                    <div class="post-stats">
                        <span><i class="far fa-heart"></i> 98</span>
                        <span><i class="far fa-comment"></i> 23</span>
                        <span><i class="far fa-share-square"></i> 47</span>
                    </div>
                    <div class="post-actions">
                        <button class="post-action-btn">
                            <i class="far fa-heart"></i>
                            <span>点赞</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-comment"></i>
                            <span>评论</span>
                        </button>
                        <button class="post-action-btn">
                            <i class="far fa-share-square"></i>
                            <span>分享</span>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 引入Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 点赞功能
            const likeButtons = document.querySelectorAll('.post-action-btn');
            likeButtons.forEach(button => {
                // 处理点赞按钮
                if (button.querySelector('.fa-heart')) {
                    button.addEventListener('click', function() {
                        const icon = this.querySelector('.fa-heart');
                        if (icon.classList.contains('far')) {
                            icon.classList.remove('far');
                            icon.classList.add('fas');
                            this.classList.add('liked');
                            this.querySelector('span').textContent = '已赞';
                            
                            // 更新点赞数
                            updateCounter(this, 0, 1);
                        } else {
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            this.classList.remove('liked');
                            this.querySelector('span').textContent = '点赞';
                            
                            // 更新点赞数
                            updateCounter(this, 0, -1);
                        }
                    });
                }
                
                // 处理转发按钮
                if (button.querySelector('.fa-retweet')) {
                    button.addEventListener('click', function() {
                        const icon = this.querySelector('.fa-retweet');
                        if (icon.classList.contains('far')) {
                            icon.classList.remove('far');
                            icon.classList.add('fas');
                            this.classList.add('reposted');
                            this.querySelector('span').textContent = '已转发';
                            
                            // 更新转发数
                            updateCounter(this, 2, 1);
                        } else {
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            this.classList.remove('reposted');
                            this.querySelector('span').textContent = '转发';
                            
                            // 更新转发数
                            updateCounter(this, 2, -1);
                        }
                    });
                }
                
                // 处理评论按钮点击显示评论区
                if (button.querySelector('.fa-comment')) {
                    button.addEventListener('click', function() {
                        const commentsSection = this.closest('.post-card').querySelector('.comments-section');
                        if (commentsSection) {
                            if (commentsSection.style.display === 'none' || !commentsSection.style.display) {
                                commentsSection.style.display = 'block';
                                // 自动聚焦到评论框
                                commentsSection.querySelector('.comment-input')?.focus();
                            } else {
                                commentsSection.style.display = 'none';
                            }
                        }
                    });
                }
            });
            
            // 评论回复功能
            const replyButtons = document.querySelectorAll('.comment-action');
            replyButtons.forEach(button => {
                if (button.textContent.includes('回复')) {
                    button.addEventListener('click', function() {
                        const commentContent = this.closest('.comment-content');
                        const replyContainer = commentContent.querySelector('.comment-replies') || 
                                              commentContent.parentElement.querySelector('.comment-replies');
                        
                        // 创建回复输入框
                        const replyInput = document.createElement('div');
                        replyInput.className = 'reply mt-2';
                        replyInput.innerHTML = `
                            <img src="https://picsum.photos/id/64/100/100" alt="你的头像" class="user-avatar">
                            <div class="comment-content" style="display: flex; gap: 0.5rem;">
                                <input type="text" class="comment-input" placeholder="回复...">
                                <button class="btn btn-sm btn-primary" style="border-radius: 50%; width: 30px; height: 30px; padding: 0;">
                                    <i class="fas fa-paper-plane"></i>
                                </button>
                            </div>
                        `;
                        
                        // 添加到回复区
                        if (replyContainer) {
                            replyContainer.appendChild(replyInput);
                            replyInput.querySelector('.comment-input').focus();
                        } else {
                            // 如果没有回复区则创建
                            const newReplyContainer = document.createElement('div');
                            newReplyContainer.className = 'comment-replies';
                            newReplyContainer.appendChild(replyInput);
                            commentContent.appendChild(newReplyContainer);
                            replyInput.querySelector('.comment-input').focus();
                        }
                        
                        // 回复发送按钮
                        replyInput.querySelector('button').addEventListener('click', function() {
                            const input = replyInput.querySelector('.comment-input');
                            if (input.value.trim()) {
                                // 这里可以添加发送回复的逻辑
                                alert('回复已发送: ' + input.value);
                                replyInput.remove();
                            }
                        });
                    });
                }
            });
            
            // 评论框聚焦效果
            const commentInputs = document.querySelectorAll('.comment-input');
            commentInputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.parentElement.classList.add('bg-light');
                });
                input.addEventListener('blur', function() {
                    this.parentElement.classList.remove('bg-light');
                });
                
                // 按Enter发送评论
                input.addEventListener('keypress', function(e) {
                    if (e.key === 'Enter' && this.value.trim()) {
                        // 这里可以添加发送评论的逻辑
                        alert('评论已发送: ' + this.value);
                        this.value = '';
                    }
                });
            });
            
            // 更新计数器辅助函数
            function updateCounter(button, index, change) {
                const statsElement = button.closest('.post-footer').querySelector('.post-stats span:nth-child(' + (index + 1) + ')');
                const currentCount = parseInt(statsElement.textContent.match(/\d+/)[0]);
                const icon = statsElement.querySelector('i').outerHTML;
                statsElement.innerHTML = `${icon} ${currentCount + change}`;
            }
        });
    </script>
</body>
</html>
    